// index.ts
import {createRouter,  createWebHashHistory, RouteRecordRaw} from 'vue-router'
// import HelloWorld from '../components/HelloWorld.vue'
import Layout from "../layout/index.vue";
export const constantRoutes: RouteRecordRaw[] = [
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/login.vue'),
    meta: {
      hidden: true,
    },
  },

  {
    path: '/403',
    name: '403',
    component: () => import('@/views/403.vue'),
    meta: {
      hidden: true,
    },
  },
  {
    path: '/404',
    name: '404',
    component: () => import('@/views/404.vue'),
    meta: {
      hidden: true,
    },
  },

]

const routes:Array<RouteRecordRaw>=[
  ...constantRoutes,
  {
    path:'/',
    name:'Login',
    redirect: "/login",
    component: Layout,
    children: [
      {
        path: "home",
        name: "Home",
        component:()=>import('@/views/home.vue'),
        meta: { title: "首页", icon: "fuwuqi" ,      isShow: true,},
        props: ({ params }) => params,
      },
      {
        path: "/user",
        name: "user",
        component:()=>import('@/views/user/index.vue'),
        meta: { title: "用户", icon: "fenlei" ,      isShow: true,},
        props: ({ params }) => params,
      },
      {
        path: "/leave",
        name: "leave",
        component:()=>import('@/views/leaveForm/leaveApply.vue'),
        meta: { title: "请假申请", icon: "fenlei" ,      isShow: true,},
        props: ({ params }) => params,
      },
      {
        path: "/claim",
        name: "claim",
        component:()=>import('@/views/expenseForm/claimApply.vue'),
        meta: { title: "报销申请", icon: "fenlei" ,      isShow: true,},
        props: ({ params }) => params,
      },
      {
        path: "/processList",
        name: "processList",
        component:()=>import('@/views/processList/index.vue'),
        meta: { title: "待办流程列表", icon: "dingdan" ,      isShow: true,},
        props: ({ params }) => params,
      },
      {
        path: "/hello",
        name: "Hello",
        component:()=>import('@/views/Helloworld.vue'),
        meta: { title: "欢迎", icon: "kejian" ,      isShow: true,},
        props: ({ params }) => params,
      }
      ,
      {
        path: "/depart",
        name: "depart",
        component:()=>import('@/views/department/depart.vue'),
        meta: { title: "部门", icon: "kejian" ,      isShow: true,},
        props: ({ params }) => params,
      }
    ],
  

  },
  {
    path:'/login',
    name:'login',
    component:()=>import('@/views/login.vue'),
    meta: {
      isShow: false, 
      title: '登陆页', 
      icon: "el-icon-s-home"
    }
  },
]

export default createRouter({
  history: createWebHashHistory(),
  routes
})
